package com.project.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * 客户实体累
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_custom")
public class Custom implements Serializable {

    private static final long serialVersionUID = 1L;

    /** 客户编号*/
    @TableId(value = "pk_customId", type = IdType.AUTO)
    private Integer customId;

    /** 名称*/
    @NotBlank(message = "客户名称必须填写")
    @Length(min = 2,max = 10,message = "客户名称的长度是2-10位之间")
    @TableField("c_name")
    private String name;

    /** 负责人*/
    @NotBlank(message = "负责人必须填写")
    @TableField("c_head")
    private String head;

    /** 负责人电话*/
    @NotBlank(message = "电话必须填写")
    @Pattern(regexp = "1[35789]\\d{9}",message = "电话必须是13、15、17、18、19开始的11位数")
    @TableField("c_headPhone")
    private String headPhone;

    /** 办公地址*/
    @NotBlank(message = "办公地址必须填写")
    @TableField("c_address")
    private String address;

    /** 邮箱*/
    @NotBlank(message = "邮箱必须填写")
    @Pattern(regexp = "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}",message ="邮箱必须是xx@xx.xx" )
    @TableField("c_email")
    private String email;

    /** 经营范围*/
    @NotBlank(message = "经营范围必须填写")
    @TableField("c_scope")
    private String scope;

}
